package com.stone.design.patterns.iterator.employeeiterator;

/**
 * @description
 * @Time 2018/4/12 13:39
 * Created by Stone on 2018/4/12.
 */

public class LiIterator implements Iterator {

    private Employee[] arrays;
    private int cursor;
    public LiIterator(Employee[] arrays) {
        this.arrays = arrays;
    }

    @Override
    public boolean hasNext() {
        return cursor < arrays.length;
    }

    @Override
    public Employee next() {
        Employee obj = null;
        if (hasNext()) {
            obj = arrays[cursor++];
        }
        return obj;
    }
}
